-
Couldn't load subscription status.
- Fork 84
disable add button on accepted/rejected tabs #828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
disable add button on accepted/rejected tabs #828
Conversation
Summary of ChangesHello @Trishamishra08, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a user experience issue in the Store View where the 'Add' button was active across all tabs, leading to confusion when items added in 'Accepted' or 'Rejected' tabs were not immediately visible. The core change involves disabling the 'Add' button for these specific tabs, making it available only when the 'Assigned' tab is selected. This ensures that users can only add products in a context where they will be immediately reflected, streamlining the inventory management process and preventing misinterpretations. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request successfully disables the 'Add' button on the 'Accepted' and 'Rejected' tabs, which aligns with the goal of improving user experience. However, I've found a couple of issues. The click handler for the new 'Add' button contains flawed logic that results in a confusing error message for the user. Additionally, there's a minor regression in the UI text where pluralization for 'item(s) counted' has been removed, leading to grammatical incorrectness. I've also noted the removal of the .env.example file, which is generally not recommended as it's a helpful guide for project setup; consider restoring it. My detailed comments and suggestions are below.
| function addNewItem() { | ||
| if (selectedSegment.value !== "assigned") return; | ||
| showToast(translate("You can only add items in the Assigned tab.")); | ||
| // add your actual add logic here... | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic inside addNewItem is flawed. Since the 'Add' button is disabled on tabs other than 'Assigned', this function will only ever be called when selectedSegment.value is 'assigned'.
However, the function currently shows a toast message saying "You can only add items in the Assigned tab.", which is confusing for the user as they are already on the correct tab. The check on line 258 is also redundant given the button's disabled state.
This function should contain the logic for adding a new item, or be an empty placeholder if the functionality is not yet implemented.
function addNewItem() {
// add your actual add logic here...
}
| <ion-note> | ||
| {{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }} | ||
| {{ translate("items counted") }} | ||
| </ion-note> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change simplifies the template, but it introduces a minor grammatical issue. The previous implementation handled the pluralization for "item counted" vs "items counted". With this change, it will always display "items counted", leading to incorrect phrases like "1 items counted".
While the old logic was complex, it's better to handle pluralization correctly. I'd suggest reintroducing the logic in a cleaner format.
<ion-note>{{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }} {{ translate((count.countTypeEnumId === "HARD_COUNT" && getCycleCountStats(count.inventoryCountImportId, true) === '1') ? "item counted" : "items counted") }}</ion-note>
| <ion-note> | ||
| {{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }} | ||
| {{ translate("items counted") }} | ||
| </ion-note> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the 'Pending review' tab, this change introduces a grammatical issue by removing the pluralization logic for "item counted". This will result in incorrect phrases like "1 items counted". It would be best to restore the pluralization handling.
<ion-note>{{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }} {{ translate((count.countTypeEnumId === "HARD_COUNT" && getCycleCountStats(count.inventoryCountImportId, true) === '1') ? "item counted" : "items counted") }}</ion-note>
Related Issues
#409
Short Description and Why It's Useful
This Pull Request disables the "Add" button when users are viewing the Accepted or Rejected tabs in the Store View.
Previously, users could add items in these tabs, but the newly added items were only visible in the All tab, causing confusion.
This change ensures that users can only add products when the items will be immediately visible, improving UX and preventing errors.
Screenshots of Visual Changes before/after (If There Are Any)
Add button enabled on Accepted/Rejected tabs

Newly added items not visible in the same tab
Add button enabled on Accepted/Rejected tabs

Newly added items not visible in the same tab
Contribution and Currently Important Rules Acceptance
I have read and followed contribution rules